package com.clear.command.demo2;

public class Main {
    public static void main(String[] args) {
        TextEditor textEditor = new TextEditor();

        // 添加文本
        textEditor.addText("Hello, ");
        textEditor.addText("world!");
        textEditor.printContent(); // 输出：Hello, world!

        // 撤销操作
        textEditor.undo();
        textEditor.printContent(); // 输出：Hello,

        // 再次添加文本
        textEditor.addText("Command Pattern!");
        textEditor.printContent(); // 输出：Hello, Command Pattern!

    }
}
